<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
	<% String path=request.getContextPath(); String basePath=request.getScheme() + "://" + request.getServerName() + ":"
		+ request.getServerPort() + path + "/" ; %>

		<!DOCTYPE html>
		<html>

		<head>
			<base href="<%=basePath%>">

			<title>海科新源业务协同管理平台(CMP)</title>

			<meta http-equiv="pragma" content="no-cache">
			<meta http-equiv="cache-control" content="no-cache">
			<meta http-equiv="expires" content="0">
			<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
			<meta http-equiv="description" content="This is my page">
			<!-- <link rel="stylesheet" href="resourse/layui-v2.4.3/layui/css/layui.css"> -->
		</head>

		<body class="easyui-layout">

			<%@ include file="/WEB-INF/jsp/common/headerSupply.jsp" %>

				<div data-options="region:'north',border:false" style="padding: 0px; overflow: hidden; height: 35px;">

					<div style="height: 30px; padding: 5px; background-color: #10a0ea;">
						<div style="float: left;">
							<span style="font-size: 18px; font-weight: bolder; color: #fff;">海科新源业务协同管理平台(CMP)</span>
						</div>
						<div style="float: right; margin: 0 100px 0 0; color: #020202;">
							<a href="javascript:" class="easyui-linkbutton" data-options="plain:true"
								style="color: #020202;">欢迎您：<span id="username"></span></a> <a
								href="javascript:logout()" data-options="plain:true" class="easyui-linkbutton"
								style="color: #020202;">退出</a>

						</div>
					</div>

					<!-- 		<div -->
					<!-- 			style="text-align: right; position: absolute; top: 0px; right: 10px;"> -->

					<!-- 			<ul id="shortcut"> -->
					<!-- 				<li><a href="javascript:;" title="首页" -->
					<!-- 					onclick="add('/Home/Default','首页');"> <img -->
					<!-- 						src="resourse/img/login/homeico.png" /> <span>首页</span> -->
					<!-- 				</a></li> -->
					<!-- 				<li><a href="javascript:;" title="修改密码" -->
					<!-- 					onclick="add('/Sys/ChangePWD','修改密码');"> <img -->
					<!-- 						src="resourse/img/login/pwdico.png" /><span>修改密码</span> -->
					<!-- 				</a></li>  -->
					<!-- 				<li><a href="sys/logout" title="退出系统"> <img -->
					<!-- 						src="resourse/img/login/quitico.png" /><span>退出系统</span> -->
					<!-- 								</a></li> -->
					<!-- 			</ul> -->
					<!-- 		</div> -->
				</div>
				<div data-options="region:'west',split:true,title:'工具栏'" style="width: 180px; padding: 10px;">
					<ul id="tt"></ul>
				</div>
				<div data-options="region:'center'">
					<div id="main" class="easyui-tabs" style="width: 99%; height: auto; padding: 0px;"
						data-options="iconCls:'icon-save',collapsible:false,minimizable:false,maximizable:false,closable:false,tools:'#tab-tools111'"
						fit="true" border="0">
						<!--工作区-->
					</div>
					<div id="tab-tools111" style="border-top: none; border-right: none;">
						<a href="javascript:void(0)" class="easyui-linkbutton" plain="true"
							data-options="plain:true,iconCls:'icon-reload'" onclick="refresh()">刷新</a>
					</div>
					<div id="tab_rightmenu" class="easyui-menu" style="width: 150px; display: none;">
						<!-- 	<div name="tab_menu-tabclose">关闭</div> -->
						<div name="tab_menu-tabcloseall">关闭全部标签</div>
						<div name="tab_menu-tabcloseother">关闭其他标签</div>
						<div class="menu-sep"></div>
						<div name="tab_menu-tabcloseright">关闭右侧标签</div>
						<div name="tab_menu-tabcloseleft">关闭左侧标签</div>
					</div>
				</div>
				<div data-options="region:'south',border:false"
					style="height: 30px; line-height: 30px; padding-left: 10px; text-align: center;">
					<span> 山东海科新源材料科技股份有限公司 </span>
				</div>

				<script type="text/javascript">

					function logout() {
						$.messager.confirm('确认提示', '确认退出?', function (r) {
							if (r) {
								$.ajax({
									type: "post",
									dataType: "json",
									url: 'supply/logoff?',
									data: {
									},
									contentType: "application/json",
									success: function (data) {
										if (data.code == 60200) {
											window.location.href = 'supply/login'
										} else {
											$.messager.alert('消息', data.msg);
										}
									},
									error: function (XMLHttpRequest, textStatus, errorThrown) {
										$.messager.alert('消息', errorThrown);
									}
								})
							}
						})
					}

					var menus = [{
						"attributes": {
							"url": "#"
						},
						"children": [{
							"attributes": {
								"url": "supply/offer"
							},
							"children": [],
							"id": "d2417c24-58f0-40e5-aab2-9e1bcd955635",
							"pid": "40a833e2-58ec-4a06-a221-f51a30e11f97",
							"text": "我的报价"
						}, {
							"attributes": {
								"url": "supply/complete"
							},
							"children": [],
							"id": "d2417c24-58f0-40e5-aab2-9e1bcd955634",
							"pid": "40a833e2-58ec-4a06-a221-f51a30e11f97",
							"text": "我的竞价"
						}, {
							"attributes": {
								"url": "supply/bid"
							},
							"children": [],
							"id": "d2417c24-58f0-40e5-aab2-9e1bcd955638",
							"pid": "40a833e2-58ec-4a06-a221-f51a30e11f97",
							"text": "我的中标"
						}, {
							"attributes": {
								"url": "supply/good"
							},
							"children": [],
							"id": "d2417c24-58f0-40e5-aab2-9e1bcd955637",
							"pid": "40a833e2-58ec-4a06-a221-f51a30e11f97",
							"text": "我的交货单"
						}, {
							"attributes": {
								"url": "supply/group"
							},
							"children": [],
							"id": "d2417c24-58f0-40e5-aab2-9e1bcd955636",
							"pid": "40a833e2-58ec-4a06-a221-f51a30e11f97",
							"text": "我的发票"
						}],
						"id": "40a833e2-58ec-4a06-a221-f51a30e11f97",
						"pid": "0",
						"state": "open",
						"text": "报价管理"
					}, {
						"attributes": {
							"url": "#"
						},
						"children": [{
							"attributes": {
								"url": "contractor/visaXY"
							},
							"children": [],
							"id": "d2417c24-58f0-40e5-aab2-9e1bcd955q48",
							"pid": "40a833e2-58ec-4a06-a221-f51a30e11f97",
							"text": "新源签证"
						}, {
							"attributes": {
								"url": "contractor/visaSP"
							},
							"children": [],
							"id": "d2417c24-58f0-40e5-aab2-9e1bcd955q49",
							"pid": "40a833e2-58ec-4a06-a221-f51a30e11f97",
							"text": "思派签证"
						}],
						"id": "40a833e2-58ec-4a06-a221-f51a30e11f97",
						"pid": "0",
						"state": "open",
						"text": "工程管理"
					}, {
						"attributes": {
							"url": "#"
						},
						"children": [{
							"attributes": {
								"url": "supply/saleLabelSupplyAudit"
							},
							"children": [],
							"id": "d2417c24-58f0-40e5-aab2-9e1bcd955q27",
							"pid": "40a833e2-58ec-4a06-a221-f51a30e11f98",
							"text": "标签打印确认"
						}],
						"id": "40a833e2-58ec-4a06-a221-f51a30e11f98",
						"pid": "0",
						"state": "open",
						"text": "标签打印管理"
					}
						, {
						"attributes": {
							"url": "#"
						},
						"children": [{
							"attributes": {
								"url": "supply/user"
							},
							"children": [],
							"id": "f8cb6d4d-0e73-4783-9bda-c0132967d78b",
							"pid": "b3e67605-8e2b-4d33-a02d-563608bdba5d",
							"text": "用户管理"
						}, {
							"attributes": {
								"url": "supply/changePwd"
							},
							"children": [],
							"id": "03678c80-58e8-44e1-8d67-0d9880749767",
							"pid": "b3e67605-8e2b-4d33-a02d-563608bdba5d",
							"text": "修改密码"
						},
						/* {
							"attributes": {
								"url": "sys/ModuleManage"
							},
							"children": [],
							"id": "8aa4ed09-5849-417c-bef3-b7c5437c4b9f",
							"pid": "b3e67605-8e2b-4d33-a02d-563608bdba5d",
							"text": "模块管理"
						},*/
						{
							"attributes": {
								"url": "supply/info"
							},
							"children": [],
							"id": "3df412ad-f75b-4fa7-b4fd-09075d71def3",
							"pid": "b3e67605-8e2b-4d33-a02d-563608bdba5d",
							"text": "档案管理"
						}],
						"id": "b3e67605-8e2b-4d33-a02d-563608bdba5d",
						"pid": "0",
						"state": "open",
						"text": "信息管理"
					}];
					$(function () {
						$("#username").html(PUser.userName)
						//绑定左侧Tree
						$('#tt').tree(
							{
								url: 'supply/selectModuleMap',
								// data: menus,
								method: 'get',
								lines: true,
								onClick: function (node) {
									if (node.attributes.url != '#'
										&& node.attributes.url != '') { // alert node text property when clicked
										add(node.attributes.url, node.text);
									}
								},
								onLoadSuccess: function () {
									// 							$('#tt').tree('collapseAll');
									//var rows = $('#tt').tree('getChildren');
									//alert(rows[0].ID);
									//if (rows.length) {
									//    $('#tt').tree('expand', rows[0].ID);
									//}
								}
							});
						//add("/PluginSrc/StatisticalSystem/Manage/ReportStateList.aspx", "首页");
						var tabsId = 'main'; //tabs页签Id
						var tab_rightmenuId = 'tab_rightmenu'; //tabs右键菜单Id

						//绑定tabs的右键菜单
						$("#" + tabsId).tabs({
							onContextMenu: function (e, title) {//这时去掉 tabsId所在的div的这个属性：class="easyui-tabs"，否则会加载2次
								e.preventDefault();
								$('#' + tab_rightmenuId).menu('show', {
									left: e.pageX,
									top: e.pageY
								}).data("tabTitle", title);
							}
						});

						//实例化menu的onClick事件
						$("#" + tab_rightmenuId).menu({
							onClick: function (item) {
								CloseTab(tabsId, tab_rightmenuId, item.name);
							}
						});

						add('sys/index', '首页');
					});

					var index = 0;

					function add(url, title) {
						if ($('#main').tabs('exists', title)) {
							if (confirm('已经打开了页面,是否关闭并重新加载该标签？\n警告：点击[确定]会关闭原有的标签页面并重新加载！！！如果你还没有保存过数据,请选【取消】！,')) {
								//$('#tt').tabs('select', title);
								$('#main').tabs('close', title);
								$('#main')
									.tabs(
										'add',
										{
											title: title,
											content: "<iframe scrolling=\"auto\" frameborder=\"0\" Src=\""
												+ url
												+ "\" Style=\"width:100%;height:99%;\"></iframe>",
											iconCls: 'icon-applicationgo',
											closable: true
										});
							} else {
								$('#main').tabs('select', title);
							}
						} else {
							$('#main')
								.tabs(
									'add',
									{
										title: title,
										content: "<iframe scrolling=\"auto\" frameborder=\"0\" Src=\""
											+ url
											+ "\" Style=\"width:100%;height:99%;\"></iframe>",
										iconCls: 'icon-applicationgo',
										closable: true
									});
						}
					}

					function refresh() {
						var currTab = $('#main').tabs('getSelected'); //获得当前tab
						if (currTab) {
							var url = $(currTab.panel('options').content).attr('src');
							var title = currTab.panel('options').title;
							$('#main').tabs('close', title);
							add(url, title);
						}
					}
				</script>
				<!-- 	<script src="resourse/layui-v2.4.3/layui/layui.js"></script> -->
				<!-- 	<script> -->
				<!-- 	</script> -->
		</body>

		</html>